﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ReverseGeoLookup
{
    class Program
    {

        // http://stackoverflow.com/questions/3151450/google-geolocation-api-use-longitude-and-latitude-to-get-address

        static void Main(string[] args)
        {

            // 	-40.402864	-20.342288	0.0	0.0	BR-262 - Pistal Lateral - Vila Capixaba, Cariacica - ES, Brazil
            // -40.288124	-20.355536	0.0	0.0	R. Natal, 1-61 - Praia de Itapoã, Vila Velha - ES, 29101-710, Brazil
            // http://code.google.com/apis/maps/documentation/geocoding/#ReverseGeocoding
            //http://maps.google.com/maps/api/geocode/xml?latlng=40.714224,-73.961452&sensor=false

            //string longitude = "40.714224"; string latitude = "-73.961452";
            string longitude = "-40.288124"; string latitude = "-20.355536";
            string Address_ShortName="";
            string Address_country="";
            string Address_administrative_area_level_1="";
            string Address_administrative_area_level_2="";
            string Address_administrative_area_level_3="";
            string Address_colloquial_area="";
            string Address_locality="";
            string Address_sublocality="";
            string Address_neighborhood="";

            ReverseGeoLookup.ReverseGeoLoc(longitude, latitude,
                out Address_ShortName,
                out Address_country,
                out Address_administrative_area_level_1,
                out Address_administrative_area_level_2,
                out Address_administrative_area_level_3,
                out Address_colloquial_area,
                out Address_locality,
                out Address_sublocality,
                out Address_neighborhood);

            Console.WriteLine(
                "Address_ShortName=" + Address_ShortName + " - " +
                "Address_country=" + Address_country + " - " +
                "Address_administrative_area_level_1=" + Address_administrative_area_level_1 + " - " +
                "Address_administrative_area_level_2=" + Address_administrative_area_level_2 + " - " +
                "Address_administrative_area_level_3=" + Address_administrative_area_level_3 + " - " +
                "Address_colloquial_area=" + Address_colloquial_area + " -  " +
                "Address_locality=" + Address_locality + " - " +
                "Address_sublocality=" + Address_sublocality + " - " +
                "Address_neighborhood=" + Address_neighborhood);

            Console.In.ReadLine();

        }
    }
}
